package com.ygxsk.carhome.ui.adapter;

import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.flyco.roundview.RoundTextView;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.response.EvaluteCurrentItemBean;
import com.ygxsk.carhome.utils.CommUtils;
import com.ygxsk.carhome.utils.StringCodeUtils;
import com.ygxsk.carhome.utils.ViewUitls;

import java.util.List;

/*
 * @Author:itchenqi175@163.com
 * @Time:2023-07-14  18:37
 * @Description:车辆评估的主要列表适配器
 */
public class EvaluateListItemAdapter extends BaseQuickAdapter<EvaluteCurrentItemBean, BaseViewHolder> {

    //    public LeadListItemAdapter(int layoutResId) {
//        super(layoutResId);
//    }
    public EvaluateListItemAdapter(int layoutResId, @Nullable List<EvaluteCurrentItemBean> data) {
        super(layoutResId, data);
        //设置点击事件；
        addChildClickViewIds(R.id.textvieweditviewphoneevaluate);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, EvaluteCurrentItemBean leadListItemBean) {

        //设置item数据；
        //获取名字
        String customerName = leadListItemBean.getCustomerName();
        //获取电话
        String customerPhone = leadListItemBean.getCustomerPhone();
        //获取这个条目的状态  文字形式--分配状态
        String statusName = leadListItemBean.getStatusName();
        //单个的汽车的状态
//        String stateCar = leadListItemBean.getStateCar();
        //车辆评估的状态 文字形式
        String estimateTypeName = leadListItemBean.getEstimateTypeName();
        //车辆的评估来源
//        String evaluateTypeValue = leadListItemBean.getEvaluateTypeInfo();

        //findViews

        //名称
        TextView textViewPersonName = (TextView) baseViewHolder.getView(R.id.textviewpersonnameevaluate);

        //车辆的状态
//        RoundTextView textViewStateCarInfo = (RoundTextView) baseViewHolder.getView(R.id.textviewstatecarinfo);
        //人员来源的状态
        RoundTextView textViewLeadFormWhere = (RoundTextView) baseViewHolder.getView(R.id.textviewleadformwhereevaluate);

        //该条目状态
        TextView textViewPhone = (TextView) baseViewHolder.getView(R.id.textvieweditviewphoneevaluate);
        //人员的分配状态
        TextView textViewPersonAssignedState = (TextView) baseViewHolder.getView(R.id.textviewpersonassignedstateevaluate);


        //名称
        CommUtils.setText(textViewPersonName, customerName);

        //车子的状态
//        CommUtils.setText(textViewStateCarInfo, stateCar);

        ViewUitls.method_roundText_tag_show_or_hide(textViewLeadFormWhere, estimateTypeName);

        //车辆的评估 来源
        CommUtils.setText(textViewLeadFormWhere, estimateTypeName);

        //手机号
//        CommUtils.setText(textViewPhone, customerPhone);
        CommUtils.setText(textViewPhone, StringCodeUtils.mobileEncrypt(customerPhone));

        //该客户的分配状态
        CommUtils.setText(textViewPersonAssignedState, statusName);

    }

}

